package com.example.myapplication3;

/**
 * 单例模式：被设置为单例的类，只允许有一个对象（不允许在外部new对象）
 */
public class Singleton
{

    private static Singleton sInstance;

    private Singleton()
    {

    }

    public static Singleton getInstance()
    {
        if (null == sInstance)
        {
            sInstance = new Singleton();
        }
        return sInstance;
    }

    public String getName()
    {
        return "Singltone";
    }
}